import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-09-22
 * Time: 21:03
 */
public class Test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        PriorityQueue<String> queue = new PriorityQueue<>(2 * n,new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o2.compareTo(o1);
            }
        });
        String s = in.nextLine();
        String[] S = s.split(" ");
        for(String tmp : S) {
            queue.offer(tmp);
        }
        for(int i = 0; i < n; i++) {
            queue.poll();
        }
        long sum = 0;
        for(int i = 0; i < n; i++) {
            String str = queue.poll();
            sum += Integer.parseInt(str);
        }

        System.out.println(sum);
    }
}
